package 文件io;
import java.io.*;
//需要实现Serializable接口，标记类为可序列化，防止出现java.io.Serializable异常
//需要序列化 1 对象保存到文件(硬件介质)时需要序列化2对象在网络传输时需要序列化
public class Student implements Serializable
{
	private String name;
	private int age;
	private String sex;
	private transient int id;//transient关键字，序列化对象存储时，这个属性不会被存储 

	public Student(String name, int age, String sex)
	{
		this.name = name;
		this.age = age;
		this.sex = sex;
	}


	public void setName(String name)
	{
		this.name = name;
	}

	public String getName()
	{
		return name;
	}

	public void setAge(int age)
	{
		this.age = age;
	}

	public int getAge()
	{
		return age;
	}

	public void setSex(String sex)
	{
		this.sex = sex;
	}

	public String getSex()
	{
		return sex;
	}

	@Override
	public String toString()
	{
		// TODO: Implement this method
		return "Student ["+"name="+name+" age="+age+" sex="+sex+"]";
	}
	
}
